﻿/*******************************************************************************
 * Copyright © 2017 FriendStar.Framework 版权所有
 * Author: HYF
 * Description: FriendStar快速开发平台
 * Website：http://www.FriendStar.cn
*********************************************************************************/
using FriendStar.Code;
using FriendStar.Domain.Entity.BaseData;
using FriendStar.Domain.IRepository.BaseData;
using FriendStar.Repository.BaseData;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;

namespace FriendStar.Application.BaseData
{
    public class CWB_JG_21_StoSettlePriceApp
    {
        private ICWB_JG_21_StoSettlePriceRepository service = new CWB_JG_21_StoSettlePriceRepository();

        public List<CWB_JG_21_StoSettlePriceEntity> GetList()
        {
            return service.IQueryable().OrderBy(t => t.UseUnit).ToList();
        }
        public CWB_JG_21_StoSettlePriceEntity GetForm(string keyValue)
        {
            return service.FindEntity(keyValue);
        }
     
        public CWB_JG_21_StoSettlePriceEntity GetEntity(string productionNO, string proCompanyNO, string productionTypeNO)
        {
            var expression = ExtLinq.True<CWB_JG_21_StoSettlePriceEntity>();
            expression = expression.And(p => p.FProductionNO == productionNO && p.FProCompanyNO == proCompanyNO && p.FProductionTypeNO == productionTypeNO);
            return service.FindEntity(expression);
        }
        public void DeleteForm(string keyValue)
        {
            
        }
        public void SubmitForm(CWB_JG_21_StoSettlePriceEntity CWB_JG_21_StoSettlePriceEntity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                service.Update(CWB_JG_21_StoSettlePriceEntity);
            }
            else
            {
                service.Insert(CWB_JG_21_StoSettlePriceEntity);
            }
        }
    }
}
